home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / HoW Developer’s Kit 1.2 / HoWSample / HoWSample Help / HoWSample Help.rsrc / STR#_1027.txt < prev    next >
Encoding:
Text File  |  1994-10-17  |  12.1 KB  |  637 lines

  1. 
  2.  
  3. 
  4.  
  5. x
  6.  
  7. x
  8.  
  9. √•Building a Help File
  10.  
  11. 
  12.  
  13. 
  14.  
  15. Here, I describe briefly what you have to do to make a help file.  These
  16.  
  17. instructions apply whether or not you‚Äôve decided to make the help file a
  18.  
  19. real document, separate from your application.
  20.  
  21. 
  22.  
  23. 
  24.  
  25. 
  26.  
  27. 
  28.  
  29. xWhat Is a Help File?
  30.  
  31. 
  32.  
  33. Your Help on Wheels client application must have a help file, which the
  34.  
  35. server can open when it‚Äôs time to display help.  When it opens your help
  36.  
  37. file, the server needs to find and display the information fast.  Reading a
  38.  
  39. mixed text/graphic format would take too long, so Help on Wheels uses a
  40.  
  41. special format designed by John Norstad for his famous Disinfectant
  42.  
  43. anti-virus application.  This format consists of a collection of resources
  44.  
  45. which can be quickly read and translated into a list data structure,
  46.  
  47. complete with text, pictures, and indexing information.  As improved for
  48.  
  49. use with Help on Wheels, this format also allows for hypertext buttons
  50.  
  51. and multilingual help files.
  52.  
  53. 
  54.  
  55. 
  56.  
  57. 
  58.  
  59. 
  60.  
  61. xHow Do I Make One?
  62.  
  63. 
  64.  
  65. You will need the special ‚Äúwrap‚Äù and ‚Äúcvrt‚Äù MPW tools and the Rez file
  66.  
  67. HoWRez.{language}.r, provided in this developer‚Äôs kit, to produce a help
  68.  
  69. file in this format.  (A note to those familiar with Norstad‚Äôs source
  70.  
  71. archive:  These tools are not quite the same as the ones he provided, but
  72.  
  73. they do use the same syntax, so the syntax description included here is
  74.  
  75. his.  The tools provided are guaranteed to work correctly for all uses
  76.  
  77. described in these instructions.  Please address any questions about these
  78.  
  79. tools to me, not to Mr. Norstad.)  The HoWSample Make file shows how
  80.  
  81. the tools and Rez file were used to build this help file.
  82.  
  83. 
  84.  
  85. 
  86.  
  87. You may have noticed that this help file, viewed through the help server,
  88.  
  89. is a mixture of pictures and text.  The help source document, however, is
  90.  
  91. a plain text file.  When reading this section, you may want to compare
  92.  
  93. what you see through Help on Wheels with the help source document.
  94.  
  95. 
  96.  
  97. To produce a help source document for your application, you can use any
  98.  
  99. text editor which wraps long lines and is able to ‚Äúsave as text.‚Äù
  100.  
  101. TeachText is fine; Microsoft Word is good too, as long as you remember
  102.  
  103. to ‚Äúsave as text‚Äù and not to edit the pictures into the ‚Äú.doc‚Äù file itself.
  104.  
  105. MPW Shell is not good for this purpose, because it doesn‚Äôt wrap long lines.
  106.  
  107. 
  108.  
  109. 
  110.  
  111. 
  112.  
  113. xWhat‚Äôs in a Source Document?
  114.  
  115. 
  116.  
  117. The paragraphs you see in a help file like this one are just long lines of
  118.  
  119. text in the help source document, with no carriage returns between lines.
  120.  
  121. (The ‚Äúwrap‚Äù tool does the line wrapping for you; the help server will
  122.  
  123. re-wrap the lines when printing, according to the user‚Äôs Page Setup
  124.  
  125. specifications.)  There are usually two carriage returns between
  126.  
  127. paragraphs, to ensure some white space between.
  128.  
  129. 
  130.  
  131. 
  132.  
  133. Everything in a help source document that isn‚Äôt paragraph text is a
  134.  
  135. markup directive.  These directives are similar to those of markup
  136.  
  137. languages such as GML and nroff.  For example, the pictures you see in
  138.  
  139. this help file are stored in the help file as 'PICT' resources.  They were
  140.  
  141. positioned between paragraphs using a simple markup directive in the help
  142.  
  143. source document:
  144.  
  145.  \pict 429
  146.  
  147. Other markup directives let you set the justification and style of a
  148.  
  149. paragraph, like the centered italic text you have just read.  You also use
  150.  
  151. markup directives to put entries in the table of contents, break pages,
  152.  
  153. build keep blocks, and so on.
  154.  
  155. 
  156.  
  157. 
  158.  
  159. 
  160.  
  161. xHow Do I Index My Help File?
  162.  
  163. 
  164.  
  165. The table of contents built from your markup directives appears in the
  166.  
  167. server‚Äôs help window, so that the user can browse by topic.  It also
  168.  
  169. appears, complete with page numbers, at the front of the help file when
  170.  
  171. printed.  This method of indexing your help file is suitable for humans, but
  172.  
  173. not for your client application.
  174.  
  175. 
  176.  
  177. 
  178.  
  179. The other important use of markup directives is to put numeric tag values
  180.  
  181. on important points in the help file.  Tags have two main uses in Help on
  182.  
  183. Wheels help files.  First, they allow the client to summon information on a
  184.  
  185. specific topic by citing a tag value when asking the server to display the
  186.  
  187. help file.  The server will scroll the help file to make the tag point visible.
  188.  
  189. Second, they introduce blocks of information which the user can click to
  190.  
  191. cause an action.  These hypertext ‚Äúbuttons‚Äù may be single paragraphs or
  192.  
  193. pictures, or several together, such as a figure and its caption.
  194.  
  195. 
  196.  
  197. Hypertext tags are worth a closer look, because they can add a lot to the
  198.  
  199. impact of your help file.  Hypertext buttons in Help on Wheels are of two
  200.  
  201. types:  link buttons and hot buttons.  When the user clicks a link button,
  202.  
  203. the server scrolls to another part of the help file to display related
  204.  
  205. information.  With a hot button, the server activates the client and sends
  206.  
  207. it a Help event, telling it which button was clicked.  Your client can
  208.  
  209. respond in any way you think is appropriate.
  210.  
  211. 
  212.  
  213. Hypertext tags are distinguished from ordinary tags by their negative
  214.  
  215. numbers.  (Conventionally, hypertext paragraphs are underlined, but you
  216.  
  217. must insert the style directive to make this happen.)  The button extends
  218.  
  219. from the hypertext tag to the next tag.  You can use a ‚Äú\tag 0‚Äù directive
  220.  
  221. to end a hypertext block, if you have no other reason to put a tag there.
  222.  
  223. The button is a link button only if there is another tag in the help file
  224.  
  225. whose number is the same, but positive, indicating the target of the link.
  226.  
  227. If there is no complementary target for the hypertext tag, then the button
  228.  
  229. is a hot button.
  230.  
  231. 
  232.  
  233. 
  234.  
  235. 
  236.  
  237. xPutting it Together
  238.  
  239. 
  240.  
  241. Here I describe what MPW commands you need to build a help file.  You
  242.  
  243. should make these commands part of your Make file, as is the case with
  244.  
  245. HoWSample.
  246.  
  247. 
  248.  
  249. 
  250.  
  251. The MPW tools ‚Äúcvrt‚Äù and ‚Äúwrap‚Äù can be piped together, so that your
  252.  
  253. help source document goes in one end, and your help file comes out the
  254.  
  255. other.  The following option values are standard for use with Help on
  256.  
  257. Wheels:  ‚Äúwrap -r 335 -p‚Äù; ‚Äúcvrt -w 345 -h 12‚Äù.  In addition, ‚Äúcvrt‚Äù
  258.  
  259. needs to know the name of the file where the 'PICT' resources are stored
  260.  
  261. (‚Äú-p‚Äù), and the ID numbers for the generated 'STR#' (‚Äú-i‚Äù), 'TCON'
  262.  
  263. (‚Äú-t‚Äù), 'TAG ' (‚Äú-g‚Äù), and 'CELL' (‚Äú-c‚Äù) resources.  There may actually
  264.  
  265. be several 'STR#' resources, depending on the length of the source
  266.  
  267. document and the number of ‚Äú\str#‚Äù directives in it.
  268.  
  269. 
  270.  
  271. [The following descriptions are reprinted from the source by John
  272.  
  273. Norstad.]
  274.  
  275. 
  276.  
  277. 
  278.  
  279. wrap -r xxxx [-p]
  280.  
  281. 
  282.  
  283. xxxx = right margin in pixels.
  284.  
  285. 
  286.  
  287. -p = if specified, add a special end-of-paragraph byte 31 to the end of
  288.  
  289. each line.
  290.  
  291. 
  292.  
  293. 
  294.  
  295. 
  296.  
  297. cvrt -o file1 -i nnn [-t aaa] [-g bbb] [-c ccc] [-p file2 -h xxx -w yyy]
  298.  
  299. [file3]
  300.  
  301. 
  302.  
  303. file1 = output resource file.
  304.  
  305. nnn = starting STR# resource id.
  306.  
  307. aaa = TCON resource id.
  308.  
  309. bbb = TAG resource id.
  310.  
  311. ccc = CELL resource id.
  312.  
  313. file2 = pict resource file.
  314.  
  315. xxx = height of report cells in pixels.
  316.  
  317. yyy = width of report cells in pixels.
  318.  
  319. file3 = input text file.
  320.  
  321. 
  322.  
  323. The text file is converted to a consecutive sequence of STR# resources
  324.  
  325. starting with id nnn.
  326.  
  327. 
  328.  
  329. The source text is intermixed with special cvrt directives.  Any line
  330.  
  331. starting with the character ‚Äò\‚Äô is treated as a directive.  Directives must
  332.  
  333. be all lower case.  The syntax checking by this tool is minimal.
  334.  
  335. 
  336.  
  337. 
  338.  
  339. 
  340.  
  341.  \str#
  342.  
  343. 
  344.  
  345. Starts a new STR# resource.
  346.  
  347. 
  348.  
  349. 
  350.  
  351. 
  352.  
  353.  \tcon title
  354.  
  355. 
  356.  
  357. Table of contents entry.  The title and the current line number (zero
  358.  
  359. based) are saved in the TCON resource.
  360.  
  361. 
  362.  
  363. 
  364.  
  365. 
  366.  
  367.  \tag nnn
  368.  
  369. 
  370.  
  371. Tag resource entry.  The number nnn and the current line number (zero
  372.  
  373. based) are saved in the TAG resource.
  374.  
  375. 
  376.  
  377. 
  378.  
  379. 
  380.  
  381.  \style xxx xxx xxx
  382.  
  383. 
  384.  
  385. The next text line is drawn in the specified style or styles.  xxx may be
  386.  
  387. any of the following:
  388.  
  389. 
  390.  
  391. normal (default)
  392.  
  393. bold
  394.  
  395. italic
  396.  
  397. underline
  398.  
  399. outline
  400.  
  401. shadow
  402.  
  403. condense
  404.  
  405. extend
  406.  
  407. 
  408.  
  409. 
  410.  
  411. 
  412.  
  413.  \just xxx
  414.  
  415. 
  416.  
  417. The next text line or picture is drawn with the specified justification.
  418.  
  419. xxx may be any of the following:
  420.  
  421. 
  422.  
  423. left        (default for text lines)
  424.  
  425. center      (default for pictures)
  426.  
  427. right
  428.  
  429. 
  430.  
  431. 
  432.  
  433. 
  434.  
  435.  \size xxx
  436.  
  437. 
  438.  
  439. Print the following line of text xxx% larger than normal.  Printing only.
  440.  
  441. The normal font size is multiplied by xxx%, then truncated.  For
  442.  
  443. non-laserwriters it is then rounded down to the nearest font size which
  444.  
  445. can be printed without Font Manager scaling.
  446.  
  447. 
  448.  
  449. 
  450.  
  451. 
  452.  
  453.  \only xxx xxx
  454.  
  455. 
  456.  
  457. The next text line or picture or table of contents entry should only be
  458.  
  459. output as specified.  xxx may be any of the following:
  460.  
  461. 
  462.  
  463. screen     Only in the report on the screen.
  464.  
  465. print      Only in the printed document.
  466.  
  467. save       Only in the saved document.
  468.  
  469. 
  470.  
  471. The default for text lines is:    screen print save
  472.  
  473. The default for pictures is:      screen print
  474.  
  475. The default for tcon entries is:  screen print
  476.  
  477. 
  478.  
  479. 
  480.  
  481. 
  482.  
  483.  \pict id
  484.  
  485. 
  486.  
  487. A picture from the pict resource file should be inserted at this point.
  488.  
  489. ‚Äúid‚Äù is the resource id of the pict.
  490.  
  491. 
  492.  
  493. 
  494.  
  495. 
  496.  
  497.  \page noheader
  498.  
  499. 
  500.  
  501. Start a new page.  Printing only.  The ‚Äúnoheader‚Äù parameter is optional.
  502.  
  503. If the parameter is present, header printing is disabled until the next
  504.  
  505. ‚Äú\page‚Äù directive is encountered.
  506.  
  507. 
  508.  
  509. 
  510.  
  511. 
  512.  
  513.  \keep
  514.  
  515. 
  516.  
  517. Keep the following block of text on the same page.  Force a page break if
  518.  
  519. necessary.  Printing only.  Paragraphs are always kept on a page, never
  520.  
  521. split across page boundaries.
  522.  
  523. 
  524.  
  525. 
  526.  
  527. 
  528.  
  529.  \endkeep
  530.  
  531. 
  532.  
  533. End a keep block.  Printing only.
  534.  
  535. 
  536.  
  537. 
  538.  
  539. 
  540.  
  541.  \itcon nnn
  542.  
  543. 
  544.  
  545. Insert table of contents.  Printing only.
  546.  
  547. 
  548.  
  549. nnn = total number of printing tcon entries.  This number must be adjusted
  550.  
  551. by hand whenever you add or remove tcon entries (sorry). It is verified
  552.  
  553. at the end of the cvrt run, and if it is incorrect the correct value is
  554.  
  555. printed in an error message (this helps a bit).
  556.  
  557. 
  558.  
  559. 
  560.  
  561. The same ID numbers you gave to ‚Äúcvrt‚Äù should also appear in the Rez
  562.  
  563. command as values for the defined symbols ‚ÄúHoWi‚Äù, ‚ÄúHoWt‚Äù, ‚ÄúHoWg‚Äù,
  564.  
  565. and ‚ÄúHoWc‚Äù.  Another symbol ‚ÄúHoWa‚Äù specifies the ID number of the
  566.  
  567. generated 'ALRT', 'DITL', and 'STR ' resources.  If your help file is the
  568.  
  569. application itself, be careful not to choose ID numbers which collide with
  570.  
  571. any defined for your application‚Äôs own use.  All of these ID numbers
  572.  
  573. should be in the range allocated for applications (128 to 32767).  The
  574.  
  575. defined symbol ‚ÄúlanguageCode‚Äù can also be set.
  576.  
  577. See the section entitled ‚ÄúLanguage Support‚Äù for more details.
  578.  
  579. 
  580.  
  581. If your help file is separate from your application, it must have type
  582.  
  583. 'HoW!' and creator 'HoW?' in order to be a double-clickable Help on Wheels
  584.  
  585. document.  As well as the necessary ‚Äú-t‚Äù and ‚Äú-c‚Äù options, your Rez
  586.  
  587. command should include an option of the form ‚Äú-d
  588.  
  589. application=‚àÇ"HoWSample‚àÇ"‚Äù (or ‚Äú-d extension=‚àÇ"HoWSampleExt‚àÇ"‚Äù if
  590.  
  591. your program is an extension or control panel) to direct
  592.  
  593. HoWRez.{language}.r to generate an alert string resource, which will help
  594.  
  595. the user get a readable TeachText version if the server is not available.
  596.  
  597. 
  598.  
  599. It is likely that your documentation will change over time.  If your help
  600.  
  601. file is separate from your application, new versions of the help file may
  602.  
  603. be incompatible with old versions of the application, and vice versa.  To
  604.  
  605. help prevent errors, Help on Wheels offers an optional client version
  606.  
  607. checking capability.  To use it, include options of the form ‚Äú-d
  608.  
  609. version=0x0101 -d versionString=‚àÇ"1.0.1‚àÇ"‚Äù in your Rez command.
  610.  
  611. This will direct HoWRez.{language}.r to generate a version resource,
  612.  
  613. visible using Finder‚Äôs Get Info dialog.  HoWSample‚Äôs Make file and C
  614.  
  615. source code show how to tie these options to the application so that
  616.  
  617. version checking is enforced.  If the help file contains a version resource,
  618.  
  619. and the version code is not the same as that supplied by the application at
  620.  
  621. the time of registration, an error (wrongVersionErr) is returned to the
  622.  
  623. application.
  624.  
  625. 
  626.  
  627. You will need a separate Rez command to merge the 'PICT' resource file
  628.  
  629. into the help file, because the ‚Äúcvrt‚Äù tool doesn‚Äôt do this for you.  The
  630.  
  631. HoWSample Make file shows one way to do this.
  632.  
  633. 
  634.  
  635. 
  636.  
  637.